home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00087_Script_MODE Handlers
< prev
next >
Wrap
Text File
|
1996-03-28
|
4KB
|
156 lines
-- --------------------------------------------------------
-- Handler setMode is called when the user clicks on the
-- browser. It sets the mode.
on setMode whichMode
global mode, searchSuccessFul
-- if (mode = "index") or not(searchSuccessFul) then
-- -- in search mode but didn't do a find or search was unsuccessful so browser didn't
-- -- change
-- setIndexMode
-- else if (mode = "search") then
-- setSearchMode
-- end if
set mode = whichMode
end
-- --------------------------------------------------------
-- Handler setIndexMode
on setIndexMode
global browserTopLine, indexButton, searchButton, browserTopics
global numVisibleTopics, findButton, masterBrowserTopics
global numLinesPerBrowserEntry, mediaButton
setMode("index")
setClearedFlag(FALSE)
if isEnabled(indexButton) then -- coming from search mode
enableButton(searchButton)
enableButton(mediaButton)
activateButtonKeepActivated(indexButton)
disableUserTyping
clearSearchTopicField
disableTopicButtons
disableButton(findButton)
updatestage
set browserTopLine = 1
set browserTopics = the text of cast "browserTopics"
set masterBrowserTopics = browserTopics
setBrowserText
setSearchSuccessFul(FALSE)
clearDatabase -- clear it in previous mode
resetScrollArea
end if
end
-- --------------------------------------------------------
-- Handler setSearchMode
on setSearchMode
global indexButton, searchButton, inputField, findButton, mediaButton
setMode("search")
setClearedFlag(FALSE)
if isEnabled(searchButton) then -- coming from index mode
enableButton(indexButton)
enableButton(mediaButton)
activateButtonKeepActivated(searchButton)
enableButton(findButton)
disableTopicButtons
clearDatabase
enableUserTyping
setClearedFlag(FALSE)
end if
removeTopicPicture
end
-- --------------------------------------------------------
-- Handler disableUserTyping changes the keyDownScript to
-- process any keyDowns as scrolling for a topic in the
-- browser and not searching for a topic.
on disableUserTyping
global inputField
set the editableText of sprite inputField = FALSE
set the keyDownScript = "displayKeyLineAtTop"
set the keyUpScript = EMPTY
end
-- --------------------------------------------------------
-- Handler enableUserTyping changes the keyDownScript to
-- process any keyDowns as searching for a topic in the
-- browser and not browsing for a topic.
on enableUserTyping
global inputField
set the keyDownScript = EMPTY
set the keyUpScript = "checkReturnKey"
set the editableText of sprite inputField = TRUE
end
-- --------------------------------------------------------
-- Handler checkReturnKey makes the return key in search
-- mode behave like clicking the find button.
on checkReturnKey
global browserTopics, numVisibleLines
if (the key = RETURN) then
-- add ôline 1 of ô to avoid getting RETURN or second line
set target = line 1 of the text of cast "searchTopic"
hilite char 1 to 32000 of cast "searchTopic"
if target = "" then exit
doFind target
else
set charNumber = charToNum(the key)
set numLines = (the number of lines in browserTopics) - numVisibleLines
if (charNumber = 30) then -- up arrow key
unhiliteClickedTopic
scroll(0, -1, numLines)
else if (charNumber = 31) then -- down arrow key
unhiliteClickedTopic
scroll(0, 1, numLines)
end if
end if
end
-- --------------------------------------------------------
-- Handler setMediaMode sets the mode to media mode
on setMediaMode
global browserTopLine, indexButton, mediaButton, browserTopics
global findButton, mediaTopics, searchButton
setMode("media")
setClearedFlag(FALSE)
clearDatabase
clearSearchTopicField
enableButton(indexButton)
enableButton(searchButton)
activateButtonKeepActivated(mediaButton)
disableButton(findButton)
updatestage
set browserTopLine = 1
setBrowserTopics(mediaTopics)
setMasterBrowserTopics(browserTopics)
setBrowserText
setSearchSuccessFul(FALSE)
resetScrollArea
end